import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * Created by IntelliJ IDEA.
 * User: zm
 * Date: 2023/9/26
 */
public class Demo1 {
    static List<Integer>  path = new ArrayList<Integer>();
    static List<List<Integer>> res = new ArrayList<List<Integer>>();

    public static List<List<Integer>> subsets(int[] nums) {
        dfs(0,nums);
        return res;
    }
    public static void dfs(int cur, int[] nums){
        if(cur == nums.length){
            res.add(new ArrayList<Integer>(path));
            return;
        }
        path.add(nums[cur]);
        dfs(cur + 1, nums);
        path.remove(path.size() - 1);
        dfs(cur + 1, nums);
    }

    public static void main(String[] args) {
        System.out.println(subsets(new int[]{1, 2, 3, 4}));
    }
}
